<template>
	<view style="position: relative;">
		<view class="padding" >
			<view class="search" v-if="!showSearch">
				<view class="back"><image src="../../static/images/back_blue.png" class="back-icon" @click="goback"></image></view>
				<view class="title">浏览记录</view>
				<image src="../../static/images/search.png" class="search-icon" @click="showSearch = true" ></image>
			</view>
			<view class="search" v-if="showSearch">
				<image src="../../static/images/search.png" class="search-icon" style="margin-left: 10px;"></image>
				<view style="width: calc(100% - 120px);"> 
						<u-input placeholder="单行输入" style="font-size: 20px;" placeholder-style="font-size:20px"
						 v-model="keyword"
						 fontSize="20" border="none" class="search-class" ></u-input>
				</view>
				<view class="cancel" @click="showSearch = false">取消</view>
			</view>
			
				<view class="bg">
					<view v-for="item,index in list" class="item" :key="index">
						<image class="book" :src="item.coverPics[0]"></image>
						<view class="col-center-start" style="margin-left: 10px;justify-content: space-between;height: 80px;">
							<view class="name">
								{{item.workTitle}}
							</view>
							<view class="desc">{{item.itemTitle}}</view>
							<view class="row-end">
								<view class="desc">{{item.createTime}}</view>
							</view>
							
						</view>
					</view>
				</view>
		</view>

		
		<view class="bottom" v-if="!showSearch">
			<view class="btn" @click="showManage = true" v-if="!showManage">
				管&nbsp;&nbsp理
			</view>
			<view class="choose"  v-if="showManage">
				<view class="all">全部选择</view>
				<view class="row-w-center"><view class="all">删除</view><image src="../../static/images/delete.png" style="width: 30px;height: 30px;margin-top: -5px;"></image></view>
			</view>
		</view>
	</view>
</template>

<script>
		import titlebar from '@/pages/common/titlebar.vue'
		import {
			getViews
		} from '@/api/change/index.js'
	export default {
		components:{
				titlebar
		},
		data() {
			return {
				showManage:false,
				showSearch:false,
				keyword:'',
				list:[],
				page:1
			}
		},
		
		onLoad() {
			this.getViews()
		},
		
		methods: {
			goback(){
				uni.navigateBack()
			},
			getViews(){
				getViews({keyword:this.keyword,pageNum:this.page}).then(res=>{
					if(this.page == 1){
						this.list = []
					}
					this.list = this.list.concat(res.rows) 
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.bg{
		padding: 18px 25px 18px 25px;
		margin-left: 20px;
		margin-top: 25px;
		width: calc(100% - 40px);
		line-height: 20px;
		border-radius: 25px;
		background-color: rgba(255, 255, 255, 1);
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: center;
		font-family: Arial;
		border: 3px solid rgba(79, 79, 79, 1);
	}
	.item{
		margin-top: 10px;
		display: flex;
		padding: 10px;
		width: 100%;
		height: 100px;
		line-height: 20px;
		border-radius: 25px;
		background-color: rgba(255, 255, 255, 1);
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: center;
		font-family: Arial;
		border: 3px solid rgba(79, 79, 79, 1);
	}
	
	.book{
		width: 60px;
		height: 80px;
		border-radius: 10px;
		border: 3px solid rgba(79, 79, 79, 1);
	}
	.name{
		color: rgba(16, 16, 16, 1);
		font-size: 18px;
		text-align: left;
		font-family: HappyZcool-2016;
	}
	.desc{
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: left;
			font-family: HappyZcool-2016;
	}
	.padding {
			padding-left: 20px;
			padding-right: 20px;
		}
	.search{
		height: 60px;
		line-height: 20px;
		border-radius: 25px;
		background-color: rgba(255, 255, 255, 1);
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: center;
		font-family: Arial;
		border: 3px solid rgba(79, 79, 79, 1);
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.back{
		margin-left: 10px;
		width: 40px;
		height: 40px;
		background-color: rgba(147, 210, 243, 1);
		text-align: center;
		border: 3px solid rgba(79, 79, 79, 1);
		display: flex;
		border-radius: 50%;
		align-items: center;
		justify-content: center;
	}
	.title{
		color: rgba(79, 79, 79, 1);
		font-size: 28px;
		text-align: center;
	font-family: HappyZcool-2016;
	}
	.search-icon{
		flex-wrap: 0;
		width: 40px;
		height: 40px;
		margin-right: 10px;
	}
	.search-icon2{
		width: 40px;
		height: 40px;
	}
	.back-icon{
		width: 19px;
		height: 19px;
	}
	.cancel{
		white-space:nowrap;
		margin-right: 10px;
		color: rgba(64, 149, 229, 1);
		font-size: 28px;
		text-align: center;
	font-family: HappyZcool-2016;
	margin-right: 30px;
	}
	.bottom{
		width: 100vw;
		position: fixed;
		bottom: 0;
		height: 100px;
		line-height: 20px;
		border-radius: 25px 25px 0 0 ;
		background-color: rgba(255, 255, 255, 1);
		text-align: center;
		border: 3px solid rgba(79, 79, 79, 1);
		display: flex;
		justify-content: center;
	}
	.btn{
		margin-top: 16px;
		margin-left: 20px;
		margin-right: 20px;
		width: calc(100% - 40rpx);
		height: 50px;
		line-height: 20px;
		border-radius: 20px;
		font-family: HappyZcool-2016;
		font-size: 32px;
		color: rgba(16, 16, 16, 1);
		background-color: rgba(255, 191, 107, 1);
		text-align: center;
		border: 3px solid rgba(79, 79, 79, 1);
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.all{
		color: rgba(16, 16, 16, 1);
		font-size: 28px;
		font-family: HappyZcool-2016;
	}
	.choose{
		display: flex;
		justify-content: space-between;
		margin-left: 20px;
		margin-right: 20px;
		align-items: center;
		width: calc(100% - 40rpx);
		
	}
</style>
